<script>
	import {
		getSafeAreaInsets
	} from "../../utils/safeAreaUtil"
	export default {
		data() {
			return {
				top: 0,
				sysButHeight: 0,
				checkValue: null,
				sysBottom: 0,

			}
		},
		methods: {
			async init() {
				const {
					sysTop,
					sysButHeight,
					sysBottom
				} = await getSafeAreaInsets();
				this.top = sysTop;
				this.sysButHeight = sysButHeight;
				this.sysBottom = sysBottom
			},
		},
		async mounted() {
			this.init()
		},
		props: {
			showHead: {
				default: true,
				typeof: [Boolean]
			},
			showTitle: {
				default: true,
				typeof: [Boolean]
			},
			showBottom: {
				default: true,
				typeof: [Boolean]
			},
			showTabBar: {
				default: false,
				typeof: [Boolean]
			}
		}
	}
</script>
<template>
	<view class="layout">
		<view class="header-saf" v-if="showHead" :style="{height:top+'px'}">
		</view>
		<view class="header-button" v-if="showTitle" :style="{height:sysButHeight+'px'}">
			<slot name='title'>
			</slot>
		</view>
		<view class="content">
			<slot name='default'>
			</slot>
		</view>
		<view class="bottom" v-if="showBottom&&!showTabBar" :style="{height:sysBottom+'px'}">
		</view>
		<TabBar v-if="showTabBar"></TabBar>
	</view>
</template>

<style lang="scss" scoped>
	.bottom {
		background-color: res;
	}

	.group {
		display: flex;
		align-items: start;
		margin-top: 10rpx;
	}

	.color_b {
		color: black;
	}

	.service {
		width: 100%;
		font-size: 25rpx;
		color: rgba(0, 0, 0, 0.4);
	}

	.layout {
		height: 100vh;
		width: 750rpx;
		display: flex;
		flex-direction: column;

		.header-button {
			width: 100%;
			display: flex;
			align-items: center;
		}

		.header-saf {
			width: 100%;
		}

		.content {
			flex: 1;
		}


	}
</style>